package com.aspose.cells;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;

class zapm {
   private com.aspose.cells.a.f.zj a;
   private ChartShape b;
   private Chart c;
   private double d;
   private double e;
   private int f;
   private boolean g;
   private double[][] h;
   private HashMap i;
   private int j = 0;
   private zcfx k;
   private String l;
   private zapt m;
   private String n = "Chart";
   private String o = "ChartTitle";
   private String p = "CategoryAxisTitle";
   private String q = "ValueAxisTitle";
   private String r = "SecondCategoryAxisTitle";
   private String s = "secondValueAxisTitle";
   private String t = "SeriesAxisTitle";
   private String u = "ChartLegend";
   private String v = "PlotArea";
   private String w = "ValueAxis";
   private String x = "CategoryAxis";
   private String y = "SeriesAxis";
   private String z = "SecondValueAxis";
   private String A = "SecondCategoryAxis";
   private String B = "MajorGridLines_ValueAxis";
   private String C = "MinorGridLines_ValueAxis";
   private String D = "MajorGridLines_CategoryAxis";
   private String E = "MinorGridLines_CategoryAxis";
   private String F = "MajorGridLines_SecondValueAxis";
   private String G = "MinorGridLines_SecondValueAxis";
   private String H = "MajorGridLines_SecondCategoryAxis";
   private String I = "MinorGridLines_SecondCategoryAxis";
   private String J = "Series";
   private String K = "Point";
   private String L = "Walls";
   private String M = "Floor";
   private String N;
   private String O;
   private String P;
   private static final com.aspose.cells.b.c.a.za Q = new com.aspose.cells.b.c.a.za(new String[]{"primary-x", "primary-y", "primary-z", "secondary-x", "secondary-y"});

   public zapm(zapt var1, com.aspose.cells.a.f.zj var2, ChartShape var3, String var4) {
      this.m = var1;
      this.h = new double[6][];
      this.a = var2;
      this.b = var3;
      this.c = this.b.getChart();
      this.i = new HashMap();
      this.l = var4;
   }

   public void a() throws Exception {
      this.c();
      this.c.a(false);
   }

   private void b() throws Exception {
      this.d = this.b.getWidthInch();
      this.e = this.b.getHeightInch();
      this.f = this.c.getType();
      this.g = this.c.getIs3D();
      this.c.a(false, false);
   }

   private void c() throws Exception {
      this.b();
      this.k = zarj.a("Object " + this.l + "/content.xml", this.a);
      this.k.c();
      this.k.b("office:document-content");
      this.d();
      this.e();
      this.n();
      this.k.b();
      this.k.d();
      this.k.e();
   }

   private void d() throws Exception {
      this.k.a("xmlns", "office", (String)null, "urn:oasis:names:tc:opendocument:xmlns:office:1.0");
      this.k.a("xmlns", "style", (String)null, "urn:oasis:names:tc:opendocument:xmlns:style:1.0");
      this.k.a("xmlns", "text", (String)null, "urn:oasis:names:tc:opendocument:xmlns:text:1.0");
      this.k.a("xmlns", "table", (String)null, "urn:oasis:names:tc:opendocument:xmlns:table:1.0");
      this.k.a("xmlns", "draw", (String)null, "urn:oasis:names:tc:opendocument:xmlns:drawing:1.0");
      this.k.a("xmlns", "fo", (String)null, "urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0");
      this.k.a("xmlns", "xlink", (String)null, "http://www.w3.org/1999/xlink");
      this.k.a("xmlns", "dc", (String)null, "http://purl.org/dc/elements/1.1/");
      this.k.a("xmlns", "meta", (String)null, "urn:oasis:names:tc:opendocument:xmlns:meta:1.0");
      this.k.a("xmlns", "number", (String)null, "urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0");
      this.k.a("xmlns", "svg", (String)null, "urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0");
      this.k.a("xmlns", "chart", (String)null, "urn:oasis:names:tc:opendocument:xmlns:chart:1.0");
      this.k.a("xmlns", "dr3d", (String)null, "urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0");
      this.k.a("xmlns", "math", (String)null, "http://www.w3.org/1998/Math/MathML");
      this.k.a("xmlns", "form", (String)null, "urn:oasis:names:tc:opendocument:xmlns:form:1.0");
      this.k.a("xmlns", "script", (String)null, "urn:oasis:names:tc:opendocument:xmlns:script:1.0");
      this.k.a("xmlns", "ooo", (String)null, "http://openoffice.org/2004/office");
      this.k.a("xmlns", "ooow", (String)null, "http://openoffice.org/2004/writer");
      this.k.a("xmlns", "oooc", (String)null, "http://openoffice.org/2004/calc");
      if (this.m.n) {
         this.k.a("xmlns", "of", (String)null, "urn:oasis:names:tc:opendocument:xmlns:of:1.2");
      }

      this.k.a("xmlns", "dom", (String)null, "http://www.w3.org/2001/xml-events");
      this.k.a("xmlns", "xforms", (String)null, "http://www.w3.org/2002/xforms");
      this.k.a("xmlns", "xsd", (String)null, "http://www.w3.org/2001/XMLSchema");
      this.k.a("xmlns", "xsi", (String)null, "http://www.w3.org/2001/XMLSchema-instance");
      this.k.a("xmlns", "rpt", (String)null, "http://openoffice.org/2005/report");
      this.k.a("xmlns", "of", (String)null, "urn:oasis:names:tc:opendocument:xmlns:of:1.2");
      this.k.a("xmlns", "xhtml", (String)null, "http://www.w3.org/1999/xhtml");
      this.k.a("xmlns", "grddl", (String)null, "http://www.w3.org/2003/g/data-view#");
      this.k.a("xmlns", "tableooo", (String)null, "http://openoffice.org/2009/table");
      this.k.a("xmlns", "chartooo", (String)null, "http://openoffice.org/2010/chart");
      this.k.a("xmlns", "field", (String)null, "urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0");
      this.k.a("office", "version", (String)null, this.m.m);
   }

   private void e() throws Exception {
      this.k.b("office:automatic-styles");
      this.N = this.a(this.c.getCategoryAxis().getTickLabels());
      this.O = this.a(this.c.getValueAxis().getTickLabels());
      if (this.c.getIs3D()) {
         this.P = this.a(this.c.getSeriesAxis().getTickLabels());
      }

      this.f();
      this.a(this.c.getTitle(), this.o);
      this.g();
      this.h();
      this.l();
      this.i();
      this.j();
      this.k();
      this.k.b();
   }

   private void f() throws Exception {
      Color var1 = this.c.getChartArea().getArea().getForegroundColor();
      Line var2 = this.c.getChartArea().getBorder();
      int var3 = this.c.getChartArea().getArea().getFillFormat().getType();
      this.k.b("style:style");
      this.k.a("style", "name", (String)null, zapo.a + ++this.j);
      this.k.a("style", "family", (String)null, "chart");
      this.a(var1, var2, this.c.getChartArea().getArea().getFillFormat());
      this.k.b();
      this.i.put(this.n, zapo.a + this.j);
   }

   private void a(Title var1, String var2) throws Exception {
      if (this.a(var1)) {
         Font var3 = var1.getFont();
         Line var4 = var1.getBorder();
         Color var5 = var1.getArea().getForegroundColor();
         this.k.b("style:style");
         this.k.a("style", "name", (String)null, zapo.a + ++this.j);
         this.k.a("style", "family", (String)null, "chart");
         this.a(var5, var4, var1.getArea().getFillFormat());
         this.a(var3);
         this.k.b();
         this.i.put(var2, zapo.a + this.j);
      }

   }

   private void g() throws Exception {
      if (this.c.getShowLegend()) {
         Legend var1 = this.c.getLegend();
         Color var2 = var1.getArea().getForegroundColor();
         Line var3 = var1.getBorder();
         Font var4 = var1.getFont();
         this.k.b("style:style");
         this.k.a("style", "name", (String)null, zapo.a + ++this.j);
         this.k.a("style", "family", (String)null, "chart");
         if (this.c.getLegend().i()) {
            this.k.b("style:chart-properties");
            this.k.a("chart", "auto-position", (String)null, "true");
            this.k.b();
         }

         this.a(var2, var3, var1.getArea().getFillFormat());
         this.a(var4);
         this.k.b();
         this.i.put(this.u, zapo.a + this.j);
      }
   }

   private void h() throws Exception {
      PlotArea var1 = this.c.getPlotArea();
      this.k.b("style:style");
      this.k.a("style", "name", (String)null, zapo.a + ++this.j);
      this.k.a("style", "family", (String)null, "chart");
      this.m();
      this.a(this.c.getPlotArea().getArea().getForegroundColor(), this.c.getPlotArea().getBorder(), var1.getArea().getFillFormat());
      this.k.b();
      this.i.put(this.v, zapo.a + this.j);
   }

   private void i() throws Exception {
      for(int var1 = 0; var1 < this.c.getNSeries().getCount(); ++var1) {
         Series var2 = this.c.getNSeries().get(var1);
         this.k.b("style:style");
         this.k.a("style", "name", (String)null, zapo.a + ++this.j);
         this.k.a("style", "family", (String)null, "chart");
         this.k.b("style:chart-properties");
         if (var2.getFirstSliceAngle() != 0) {
            this.k.a("chart", "angle-offset", (String)null, Short.toString(var2.getFirstSliceAngle()));
         }

         if (var2.getExplosion() != 0) {
            this.k.a("chart", "pie-offset", (String)null, com.aspose.cells.b.a.zo.a(var2.getExplosion()));
         }

         String var3 = this.a(var2.getBar3DShapeType());
         if (var3 != null) {
            this.k.a("chart", "solid-type", (String)null, var3);
         }

         String var4 = zaqh.a(var2.getMarker().getMarkerStyle(), var2.B());
         if (!"automatic".equals(var4)) {
            this.k.a("chart", "symbol-name", (String)null, var4);
         }

         if (var2.getMarker().getMarkerStyle() != 5 && var2.getMarker().getMarkerStyle() != 0) {
            this.k.a("chart", "symbol-type", (String)null, "named-symbol");
            this.k.a("chart", "symbol-width", (String)null, com.aspose.cells.b.a.zn.b(zaqh.e((double)var2.getMarker().getMarkerSize())) + "cm");
            this.k.a("chart", "symbol-height", (String)null, com.aspose.cells.b.a.zn.b(zaqh.e((double)var2.getMarker().getMarkerSize())) + "cm");
         }

         if (var2.getDataLabels().getShowValue() && var2.getDataLabels().getShowPercentage()) {
            this.k.a("chart", "data-label-number", (String)null, "value-and-percentage");
         } else if (var2.getDataLabels().getShowValue()) {
            this.k.a("chart", "data-label-number", (String)null, "value");
         } else if (var2.getDataLabels().getShowPercentage()) {
            this.k.a("chart", "data-label-number", (String)null, "percentage");
         }

         String var5;
         if (!var2.getDataLabels().r && var2.getDataLabels().getPosition() != 9) {
            var5 = zase.c(var2.getDataLabels().getPosition(), var2.s().j());
            if (var5 != null) {
               this.k.a("chart", "label-position", (String)null, var5);
            }
         }

         if (var2.getDataLabels().K() && var2.getDataLabels().J() != 0) {
            var5 = var2.getDataLabels().getSeparatorValue();
            this.k.b("chart:label-separator");
            this.k.b("text:p");
            this.k.a(var5);
            this.k.b();
            this.k.b();
         }

         this.k.b();
         this.a(var2.getArea().getForegroundColor(), var2.getBorder(), var2.getArea().getFillFormat());
         this.k.b();
         this.i.put(this.J + var1, zapo.a + this.j);
         this.a(var2, var1);
      }

   }

   private void a(Series var1, int var2) throws Exception {
      ChartPointCollection var3 = var1.getPoints();
      if (var3 != null && var3.getCount() >= 1) {
         ChartPoint var4 = null;
         int var5 = var3.getCount();

         for(int var6 = 0; var6 < var5; ++var6) {
            ChartPoint var7 = var3.get(var6);
            if (this.a(var4, var7)) {
               this.k.b("style:style");
               this.k.a("style", "name", (String)null, zapo.a + ++this.j);
               this.k.a("style", "family", (String)null, "chart");
               if (var7.getExplosion() != 0) {
                  this.a(var7);
               }

               this.a(var7.getArea().getForegroundColor(), var7.getBorder(), var7.getArea().getFillFormat());
               this.k.b();
               this.i.put(this.K + var2 + var6, zapo.a + this.j);
            }

            var4 = var7;
         }

      }
   }

   private void a(ChartPoint var1) throws Exception {
      this.k.b("style:chart-properties");
      this.k.a("chart", "pie-offset", (String)null, zase.y(var1.getExplosion()));
      this.k.b();
   }

   private String a(int var1) {
      switch(var1) {
      case 0:
      default:
         return null;
      case 1:
      case 2:
         return "pyramid";
      case 3:
         return "cylinder";
      case 4:
      case 5:
         return "cone";
      }
   }

   private void j() throws Exception {
      if (this.c.getWalls() != null) {
         this.k.b("style:style");
         this.k.a("style", "name", (String)null, zapo.a + ++this.j);
         this.k.a("style", "family", (String)null, "chart");
         this.a(this.c.getWalls().getForegroundColor(), this.c.getWalls().getBorder(), this.c.getWalls().getFillFormat());
         this.k.b();
         this.i.put(this.L, zapo.a + this.j);
      }
   }

   private void k() throws Exception {
      if (this.c.getFloor() != null) {
         this.k.b("style:style");
         this.k.a("style", "name", (String)null, zapo.a + ++this.j);
         this.k.a("style", "family", (String)null, "chart");
         this.a(this.c.getFloor().getForegroundColor(), this.c.getFloor().getBorder(), this.c.getFloor().getFillFormat());
         this.k.b();
         this.i.put(this.M, zapo.a + this.j);
      }
   }

   private void l() throws Exception {
      Axis var1 = this.c.getCategoryAxis();
      Axis var2 = this.c.getValueAxis();
      Axis var3 = this.c.getSeriesAxis();
      Axis var4 = this.c.getSecondCategoryAxis();
      Axis var5 = this.c.getSecondValueAxis();
      if (var1.isVisible()) {
         this.a(var1, this.x);
         if (var1.getMinorGridLines().getFormattingType() != 2) {
            this.a(var1.getMinorGridLines(), this.E, true);
         }

         if (var1.getMajorGridLines().getFormattingType() != 2) {
            this.a(var1.getMajorGridLines(), this.D, true);
         }

         this.a(var1.getTitle(), this.p);
      }

      if (var2.isVisible() || zaqh.i(this.f)) {
         this.b(var2, this.w);
         if (var2.getMinorGridLines().getFormattingType() != 2) {
            this.a(var2.getMinorGridLines(), this.C, true);
         }

         if (var2.getMajorGridLines().getFormattingType() != 2) {
            this.a(var2.getMajorGridLines(), this.B, true);
         }

         this.a(var2.getTitle(), this.q);
      }

      if (var3.isVisible()) {
         this.b(var3, this.y);
         if (var3.getMinorGridLines().getFormattingType() != 2) {
            this.a(var3.getMinorGridLines(), this.C, true);
         }

         if (var3.getMajorGridLines().getFormattingType() != 2) {
            this.a(var3.getMajorGridLines(), this.B, true);
         }

         this.a(var3.getTitle(), this.t);
      }

      if (var4.isVisible()) {
         this.a(var4, this.A);
         if (var4.getMinorGridLines().getFormattingType() != 2) {
            this.a(var4.getMinorGridLines(), this.I, true);
         }

         if (var4.getMajorGridLines().getFormattingType() != 2) {
            this.a(var4.getMajorGridLines(), this.H, true);
         }

         this.a(var4.getTitle(), this.r);
      }

      if (var5.isVisible()) {
         this.b(var5, this.z);
         if (var5.getMinorGridLines().getFormattingType() != 2) {
            this.a(var5.getMinorGridLines(), this.G, true);
         }

         if (var5.getMajorGridLines().getFormattingType() != 2) {
            this.a(var5.getMajorGridLines(), this.F, true);
         }

         this.a(var5.getTitle(), this.s);
      }

   }

   private void a(Axis var1, String var2) throws Exception {
      this.k.b("style:style");
      this.k.a("style", "name", (String)null, zapo.a + ++this.j);
      this.k.a("style", "family", (String)null, "chart");
      this.k.a("style", "data-style-name", (String)null, this.N);
      this.b(var1);
      this.a(var1.getArea().getForegroundColor(), var1.getAxisLine(), var1.getArea().getFillFormat());
      this.a(var1.getTickLabels().getFont());
      this.k.b();
      this.i.put(var2, zapo.a + this.j);
   }

   private void b(Axis var1, String var2) throws Exception {
      this.k.b("style:style");
      this.k.a("style", "name", (String)null, zapo.a + ++this.j);
      this.k.a("style", "family", (String)null, "chart");
      this.k.a("style", "data-style-name", (String)null, this.O);
      this.a(var1);
      this.a(var1.getArea().getForegroundColor(), var1.getAxisLine(), var1.getArea().getFillFormat());
      this.a(var1.getTickLabels().getFont());
      this.k.b();
      this.i.put(var2, zapo.a + this.j);
   }

   private void a(Line var1, String var2, boolean var3) throws Exception {
      this.k.b("style:style");
      this.k.a("style", "name", (String)null, zapo.a + ++this.j);
      this.k.a("style", "family", (String)null, "chart");
      this.a(var1.getColor(), var1, (FillFormat)null, var3);
      this.k.b();
      this.i.put(var2, zapo.a + this.j);
   }

   private String a(TickLabels var1) throws Exception {
      String var2 = var1.getNumberFormat();
      if (var2 == null) {
         return null;
      } else {
         int var3 = var1.d();
         ArrayList var4 = this.a(var3, var2);
         String var5 = null;
         Iterator var6 = var4.iterator();

         while(var6.hasNext()) {
            zaqb var7 = (zaqb)var6.next();
            this.k.b("number:" + zaqh.l(var7.d) + "-style");
            this.k.a("style", "name", (String)null, var7.a);
            if (var5 == null) {
               var5 = var7.a;
            }

            for(Iterator var8 = var7.f.iterator(); var8.hasNext(); this.k.b()) {
               zaqq var9 = (zaqq)var8.next();
               String var10 = var9.c;
               ArrayList var11 = var9.b;
               int var12 = var9.a;
               this.k.b("number:" + zaqh.m(var12));
               Iterator var13 = var11.iterator();

               while(var13.hasNext()) {
                  String[] var14 = (String[])var13.next();
                  this.k.a("number", var14[0], (String)null, var14[1]);
               }

               if (var10 != null) {
                  this.k.a(var10);
               }
            }

            this.k.b();
         }

         return var5;
      }
   }

   private ArrayList a(int var1, String var2) {
      ArrayList var3 = new ArrayList();
      if (zaqh.e(var2) && var1 > 0) {
         var2 = zbqc.a(var1);
      }

      if (!zaqh.e(var2)) {
         if (var2.indexOf("General") != -1) {
            this.a(var1, var3);
            return var3;
         }

         String[] var4 = zaqh.l(var2);
         zaqb var5;
         if (var4.length > 1) {
            var5 = null;

            for(int var6 = 0; var6 < var4.length; ++var6) {
               String var7 = var6 == var4.length - 1 ? "N" + var1 : "N" + var1 + "P" + var6;
               var5 = new zaqb();
               var5.a(var7, var1, var4[var6]);
               if (var6 != var4.length - 1) {
                  com.aspose.cells.b.a.a.ze.a(var5.e, (Object)(new String[]{"style:volatile", "true"}));
               }

               com.aspose.cells.b.a.a.ze.a(var3, (Object)var5);
            }

            var5.b(var4.length);
         } else {
            var5 = new zaqb();
            var5.a("N" + var1, var1, var2);
            com.aspose.cells.b.a.a.ze.a(var3, (Object)var5);
         }
      } else if (var1 > 0) {
         zaqb var8 = new zaqb();
         var8.a(var1);
         com.aspose.cells.b.a.a.ze.a(var3, (Object)var8);
      }

      return var3;
   }

   private void a(int var1, ArrayList var2) {
      zaqb var3 = new zaqb();
      com.aspose.cells.b.a.a.ze.a(var2, (Object)var3);
      var3.a = "N" + var1;
      var3.d = 1;
      zaqq var4 = new zaqq(4, (String)null);
      com.aspose.cells.b.a.a.ze.a(var3.f, (Object)var4);
      com.aspose.cells.b.a.a.ze.a(var4.b, (Object)(new String[]{"min-integer-digits", "1"}));
   }

   private void a(Color var1, Line var2, FillFormat var3) throws Exception {
      this.k.b("style:graphic-properties");
      this.k.a("draw", "stroke", (String)null, this.a(var2, false));
      double var4 = var2.getWeightPt();
      if (var4 != 0.0D) {
         this.k.a("svg", "stroke-width", (String)null, com.aspose.cells.b.a.zn.b(zaqh.a(this.c.j(), var4)) + "cm");
      }

      if (var2.isVisible() && var2.getColor().c() != null && !var2.getColor().isEmpty()) {
         this.k.a("svg", "stroke-color", (String)null, this.a(var2.getColor()));
      }

      if (!var1.isEmpty()) {
         this.k.a("draw", "fill-color", (String)null, this.a(var1));
      }

      if (var3 != null) {
         if (var3.getType() != 0 && !var1.isEmpty()) {
            this.k.a("draw", "fill", (String)null, zaqf.c(var3.getType()));
         } else {
            this.k.a("draw", "fill", (String)null, "none");
         }
      }

      double var6 = var2.getTransparency();
      if (var6 != 0.0D) {
         String var8 = (1.0D - var6) * 100.0D + "%";
         this.k.a("draw", "stroke-opacity", (String)null, var8);
         this.k.a("draw", "opacity", (String)null, var8);
      }

      this.k.b();
   }

   private void a(Color var1, Line var2, FillFormat var3, boolean var4) throws Exception {
      this.k.b("style:graphic-properties");
      this.k.a("draw", "stroke", (String)null, this.a(var2, var4));
      double var5 = var2.getWeightPt();
      if (var5 != 0.0D) {
         this.k.a("svg", "stroke-width", (String)null, com.aspose.cells.b.a.zn.b(zaqh.a(this.c.j(), var5)) + "cm");
      }

      if (var2.isVisible() && var2.getColor().c() != null && !var2.getColor().isEmpty()) {
         this.k.a("svg", "stroke-color", (String)null, this.a(var2.getColor()));
      }

      if (!var1.isEmpty()) {
         this.k.a("draw", "fill-color", (String)null, this.a(var1));
      }

      if (var3 != null) {
         this.k.a("draw", "fill", (String)null, zaqf.c(var3.getType()));
      }

      double var7 = var2.getTransparency();
      if (var7 != 0.0D) {
         String var9 = (1.0D - var7) * 100.0D + "%";
         this.k.a("draw", "stroke-opacity", (String)null, var9);
         this.k.a("draw", "opacity", (String)null, var9);
      }

      this.k.b();
   }

   private String a(Color var1) {
      String var2 = com.aspose.cells.b.a.zv.a(com.aspose.cells.b.a.ze.a(var1.getR(), 16), 2, (char)'0');
      String var3 = com.aspose.cells.b.a.zv.a(com.aspose.cells.b.a.ze.a(var1.getG(), 16), 2, (char)'0');
      String var4 = com.aspose.cells.b.a.zv.a(com.aspose.cells.b.a.ze.a(var1.getB(), 16), 2, (char)'0');
      StringBuilder var5 = new StringBuilder();
      var5.append("#");
      var5.append(var2);
      var5.append(var3);
      var5.append(var4);
      return com.aspose.cells.b.a.zr.a(var5);
   }

   private void a(Font var1) throws Exception {
      this.k.b("style:text-properties");
      this.k.a("fo", "color", (String)null, this.a(var1.getColor()));
      this.k.a("fo", "font-family", (String)null, var1.getName());
      if (var1.isBold()) {
         this.k.a("fo", "font-weight", (String)null, "bold");
         this.k.a("style", "font-weight-asian", (String)null, "bold");
         this.k.a("style", "font-weight-complex", (String)null, "bold");
      }

      if (var1.isItalic()) {
         this.k.a("fo", "font-style", (String)null, "italic");
         this.k.a("fo", "font-style-asian", (String)null, "italic");
         this.k.a("fo", "font-style-complex", (String)null, "italic");
      }

      if (var1.getUnderline() == 1) {
         this.k.a("fo", "text-underline-style", (String)null, "solid");
         this.k.a("fo", "text-underline-width", (String)null, "auto");
      }

      String var2 = var1.getSize() + "pt";
      this.k.a("fo", "font-size", (String)null, var2);
      this.k.a("style", "font-size-asian", (String)null, var2);
      this.k.a("style", "font-size-complex", (String)null, var2);
      this.k.b();
   }

   private void m() throws Exception {
      this.k.b("style:chart-properties");
      if (this.c.getType() == 34 || this.c.getType() == 17 || this.c.getType() == 56) {
         this.k.a("chart", "deep", (String)null, "true");
      }

      if (zaqh.k(this.f)) {
         this.k.a("chart", "interpolation", (String)null, "cubic-spline");
      }

      if (zaqh.j(this.f)) {
         this.k.a("chart", "solid-type", (String)null, "cylinder");
      }

      if (zaqh.g(this.f)) {
         this.k.a("chart", "vertical", (String)null, "true");
         this.k.a("chart", "connect-bars", (String)null, "false");
      }

      if (zaqh.h(this.f)) {
         this.k.a("chart", "percentage", (String)null, "true");
      } else if (zaqh.f(this.f)) {
         this.k.a("chart", "stacked", (String)null, "true");
      }

      this.k.a("chart", "treat-empty-cells", (String)null, "leave-gap");
      this.k.a("chart", "include-hidden-cells", (String)null, "false");
      if (this.c.getIs3D()) {
         this.k.a("chart", "three-dimensional", (String)null, "true");
         this.k.a("chart", "right-angled-axes", (String)null, Boolean.toString(this.c.getRightAngleAxes()).toLowerCase());
      }

      this.k.b();
   }

   private void a(Axis var1) throws Exception {
      this.k.b("style:chart-properties");
      if (zaqh.i(this.c.getType())) {
         this.k.a("chart", "reverse-direction", (String)null, var1.isPlotOrderReversed() ? "false" : "true");
      } else {
         this.k.a("chart", "reverse-direction", (String)null, var1.isPlotOrderReversed() ? "true" : "false");
      }

      this.c(var1);
      this.e(this.c.getCategoryAxis());
      this.k.b();
   }

   private void b(Axis var1) throws Exception {
      this.k.b("style:chart-properties");
      this.k.a("chart", "reverse-direction", (String)null, var1.isPlotOrderReversed() ? "true" : "false");
      this.c(var1);
      this.e(this.c.getValueAxis());
      this.k.b();
   }

   private void c(Axis var1) throws Exception {
      this.k.a("chart", "logarithmic", (String)null, var1.isLogarithmic() ? "true" : "false");
      this.k.a("chart", "line-break", (String)null, "false");
      this.k.a("chart", "text-overlap", (String)null, "true");
      if (!var1.isVisible()) {
         this.k.a("chart", "visible", (String)null, "false");
      }

      this.d(var1);
      this.h(var1);
      this.g(var1);
      this.f(var1);
   }

   private void d(Axis var1) throws Exception {
      if (!var1.isAutomaticMajorUnit()) {
         this.k.a("chart", "interval-major", (String)null, com.aspose.cells.b.a.zn.b(var1.getMajorUnit()));
      }

      if (!var1.isAutomaticMinorUnit()) {
         this.k.a("chart", "interval-minor-divisor", (String)null, com.aspose.cells.b.a.zo.a((int)(var1.getMajorUnit() / var1.getMinorUnit() + 0.5D)));
      }

      if (!var1.isAutomaticMaxValue()) {
         this.k.a("chart", "maximum", (String)null, com.aspose.cells.b.a.zr.a(var1.getMaxValue()));
      }

      if (!var1.isAutomaticMinValue()) {
         this.k.a("chart", "minimum", (String)null, com.aspose.cells.b.a.zr.a(var1.getMinValue()));
      }

   }

   private void e(Axis var1) throws Exception {
      switch(var1.getCrossType()) {
      case 0:
      case 2:
         this.k.a("chart", "axis-position", (String)null, com.aspose.cells.b.a.zn.b(var1.getCrossAt()));
         break;
      case 1:
         this.k.a("chart", "axis-position", (String)null, "end");
      }

   }

   private void f(Axis var1) {
      if (var1.getTickMarkSpacing() == 1) {
         ;
      }

   }

   private void g(Axis var1) throws Exception {
      switch(var1.getTickLabelPosition()) {
      case 0:
         this.k.a("chart", "axis-label-position", (String)null, "outside-start");
         this.k.a("chart", "display-label", (String)null, "true");
         break;
      case 1:
         this.k.a("chart", "axis-label-position", (String)null, "outside-end");
         this.k.a("chart", "display-label", (String)null, "true");
         break;
      case 2:
      default:
         this.k.a("chart", "display-label", (String)null, "true");
         break;
      case 3:
         this.k.a("chart", "display-label", (String)null, "false");
      }

      this.k.a("style", "rotation-angle", (String)null, zase.y(var1.getTickLabels().getRotationAngle()));
   }

   private void h(Axis var1) throws Exception {
      switch(var1.getMinorTickMark()) {
      case 0:
      case 2:
      default:
         break;
      case 1:
         this.k.a("chart", "tick-marks-minor-inner", (String)null, "true");
         break;
      case 3:
         this.k.a("chart", "tick-marks-minor-outer", (String)null, "true");
      }

      switch(var1.getMajorTickMark()) {
      case 0:
      case 2:
      default:
         break;
      case 1:
         this.k.a("chart", "tick-marks-major-inner", (String)null, "true");
         break;
      case 3:
         this.k.a("chart", "tick-marks-major-outer", (String)null, "true");
      }

   }

   private void n() throws Exception {
      this.k.b("office:body");
      this.k.b("office:chart");
      this.o();
      this.k.b();
      this.k.b();
   }

   private void o() throws Exception {
      this.k.b("chart:chart");
      this.k.a("svg", "width", (String)null, zaqh.g(this.b.getWidthCM()) + "cm");
      this.k.a("svg", "height", (String)null, zaqh.g(this.b.getHeightCM()) + "cm");
      this.k.a("chart", "class", (String)null, this.f(this.b.getChart().getType()));
      this.k.a("chart", "style-name", (String)null, (String)this.i.get(this.n));
      this.b(this.c.getTitle(), this.o);
      this.p();
      this.q();
      this.k.b();
   }

   private void b(Title var1, String var2) throws Exception {
      if (this.a(var1)) {
         this.k.b("chart:title");
         this.k.a("svg", "x", (String)null, zaqh.g(this.h(var1.getX())) + "in");
         this.k.a("svg", "y", (String)null, zaqh.g(this.i(var1.getY())) + "in");
         this.k.a("chart", "style-name", (String)null, (String)this.i.get(var2));
         this.k.b("text:p");
         this.k.a(var1.getText());
         this.k.b();
         this.k.b();
      }

   }

   private boolean a(Title var1) {
      return var1 != null && var1.getText() != null && !var1.E() && !"".equals(var1.getText());
   }

   private void p() throws Exception {
      if (this.c.getShowLegend()) {
         this.k.b("chart:legend");

         try {
            if (this.c.getLegend() != null) {
               if (this.c.getLegend().getPosition() != 7) {
                  this.k.a("chart", "legend-position", (String)null, this.g(this.c.getLegend().getPosition()));
               }

               this.k.a("svg", "x", (String)null, zaqh.g(this.h(this.c.getLegend().getX())) + "in");
               this.k.a("svg", "y", (String)null, zaqh.g(this.i(this.c.getLegend().getY())) + "in");
               this.k.a("chart", "style-name", (String)null, (String)this.i.get(this.u));
               if (this.c.getLegend().getWidth() > 0) {
                  this.k.a("chartooo", "width", (String)null, zaqh.g(this.c.getChartObject().getWidthCM() * (double)this.c.getLegend().getWidth() / 4000.0D) + "cm");
               }

               if (this.c.getLegend().getHeight() > 0) {
                  this.k.a("chartooo", "height", (String)null, zaqh.g(this.c.getChartObject().getHeightCM() * (double)this.c.getLegend().getHeight() / 4000.0D) + "cm");
               }
            }
         } catch (Exception var5) {
            ;
         } finally {
            this.c.a(false);
         }

         this.k.b();
      }
   }

   private void q() throws Exception {
      this.k.b("chart:plot-area");
      String var1 = a(this.c);
      if (var1 != null) {
         this.k.a("table", "cell-range-address", (String)null, var1);
      }

      if (this.c.getPlotArea() != null || this.c.getChartArea() != null) {
         this.r();
      }

      if (this.g) {
         String var2 = this.c.getPlotArea().A();
         if (var2 != null) {
            this.k.a("dr3d", "transform", (String)null, var2);
            if (zaqh.i(this.f)) {
               this.k.a("dr3d", "vrp", (String)null, this.x());
               this.k.a("dr3d", "vpn", (String)null, this.y());
               this.k.a("dr3d", "vup", (String)null, this.z());
            }

            this.k.a("dr3d", "ambient-color", (String)null, "#cccccc");
            this.k.a("dr3d", "shade-mode", (String)null, "flat");
            this.k.a("dr3d", "shadow-slant", (String)null, "0");
            this.k.a("dr3d", "projection", (String)null, "perspective");
         }
      }

      this.k.a("chart", "style-name", (String)null, (String)this.i.get(this.v));
      this.s();
      this.v();
      this.w();
      if (this.b(this.f)) {
         Iterator var4 = this.c.m().iterator();

         while(var4.hasNext()) {
            ziz var3 = (ziz)var4.next();
            if (var3.t()) {
               this.a(true, var3.u());
               this.a(false, var3.v());
            }

            if (var3.n()) {
               this.a(var3.o());
            }
         }
      }

      this.k.b();
   }

   private void r() throws Exception {
      if (this.c.getPlotArea() != null) {
         double var1 = this.h(this.c.getPlotArea().getX());
         double var3 = this.j(this.c.getPlotArea().getWidth());
         double var5 = 0.0D;
         if (this.h[1] != null) {
            var5 += Math.abs(this.h[1][0]) * 2.0D;
            var1 -= var5;
         }

         if (this.h[3] != null) {
            var5 += Math.abs(this.h[3][0]) * 2.0D;
         }

         if (var1 < 0.0D) {
            var1 = 0.0D;
         }

         this.k.a("svg", "x", (String)null, zaqh.g(zaqh.f(var1)) + "cm");
         var3 += var5;
         if (var3 > this.d) {
            var3 = this.d;
         }

         this.k.a("svg", "width", (String)null, zaqh.g(zaqh.f(var3)) + "cm");
         var1 = this.i(this.c.getPlotArea().getY());
         var3 = this.k(this.c.getPlotArea().getHeight());
         var5 = 0.0D;
         if (this.h[2] != null) {
            var5 += Math.abs(this.h[2][1]) * 2.0D;
            var1 -= var5;
         }

         if (this.h[0] != null) {
            var5 += Math.abs(this.h[0][1]) * 2.0D;
         }

         if (var1 < 0.0D) {
            var1 = 0.0D;
         }

         this.k.a("svg", "y", (String)null, zaqh.g(zaqh.f(var1)) + "cm");
         var3 += var5;
         if (var3 > this.e) {
            var3 = this.e;
         }

         this.k.a("svg", "height", (String)null, zaqh.g(zaqh.f(var3)) + "cm");
      }

   }

   private void s() throws Exception {
      switch(this.f) {
      case 35:
      case 36:
      case 44:
      case 45:
      case 46:
      case 47:
      case 48:
      case 49:
         this.t();
         this.u();
         return;
      case 37:
      case 38:
      case 39:
      case 40:
      case 41:
      case 42:
      case 43:
      default:
         this.c(this.c.getCategoryAxis(), "primary-x");
         this.c(this.c.getValueAxis(), "primary-y");
         this.c(this.c.getSeriesAxis(), "primary-z");
         this.c(this.c.getSecondCategoryAxis(), "secondary-x");
         this.c(this.c.getSecondValueAxis(), "secondary-y");
      }
   }

   private void t() throws Exception {
      if (this.c.getNSeries().getCount() >= 1) {
         if (this.c.getCategoryAxis().isVisible()) {
            this.k.b("chart:axis");
            this.k.a("chart", "dimension", (String)null, "x");
            this.k.a("chart", "name", (String)null, "primary-x");
            this.k.a("chart", "style-name", (String)null, (String)this.i.get(this.x));
            if (this.c.getNSeries().getCount() > 0) {
               String var1 = this.c.getNSeries().get(0).getXValues();
               if (var1 != null && !"".equals(var1)) {
                  this.k.b("chart:categories");
                  this.k.a("table", "cell-range-address", (String)null, a(var1));
                  this.k.a("chart", "style-name", (String)null, (String)this.i.get(this.x));
                  this.k.b();
               }
            }

            this.k.b();
         }
      }
   }

   private void u() throws Exception {
      this.k.b("chart:axis");
      this.k.a("chart", "dimension", (String)null, "y");
      this.k.a("chart", "name", (String)null, "primary-y");
      this.k.a("chart", "style-name", (String)null, (String)this.i.get(this.w));
      this.k.b();
   }

   private void c(Axis var1, String var2) throws Exception {
      if (var1.isVisible()) {
         this.k.b("chart:axis");
         this.k.a("chart", "name", (String)null, var2);
         if (var1.b() == 1) {
            this.k.a("chart", "dimension", (String)null, "y");
            this.k.a("chart", "style-name", (String)null, (String)this.i.get(this.w));
         } else if (var1.b() == 0) {
            this.k.a("chart", "dimension", (String)null, "x");
            this.k.a("chart", "style-name", (String)null, (String)this.i.get(this.x));
            if (this.c.getNSeries().getCount() > 0 && a(this.c.getNSeries().get(0).m())) {
               String var3 = this.c.getNSeries().get(0).getXValues();
               if (var3 != null && !"".equals(var3)) {
                  this.k.b("chart:categories");
                  this.k.a("table", "cell-range-address", (String)null, a(var3));
                  this.k.a("chart", "style-name", (String)null, (String)this.i.get(this.x));
                  this.k.b();
               }
            }
         } else if (var1.b() == 2) {
            this.k.a("chart", "dimension", (String)null, "z");
            this.k.a("chart", "style-name", (String)null, (String)this.i.get(this.y));
         }

         switch(Q.a(var2)) {
         case 0:
            this.b(var1.getTitle(), this.p);
            break;
         case 1:
            this.b(var1.getTitle(), this.q);
            break;
         case 2:
            this.b(var1.getTitle(), this.t);
            break;
         case 3:
            this.b(var1.getTitle(), this.r);
            break;
         case 4:
            this.b(var1.getTitle(), this.s);
         }

         if (var1.getMajorGridLines().getFormattingType() != 2) {
            this.a(var1.getMajorGridLines(), "major");
         }

         if (var1.getMinorGridLines().getFormattingType() != 2) {
            this.a(var1.getMinorGridLines(), "minor");
         }

         this.k.b();
      }
   }

   private void a(Line var1, String var2) throws Exception {
      this.k.b("chart:grid");
      this.k.a("chart", "class", (String)null, var2);
      if ("major".equals(var2)) {
         this.k.a("chart", "style-name", (String)null, (String)this.i.get(this.B));
      }

      if ("minor".equals(var2)) {
         this.k.a("chart", "style-name", (String)null, (String)this.i.get(this.C));
      }

      this.k.b();
   }

   private void v() throws Exception {
      SeriesCollection var1 = this.c.getNSeries();
      int var2 = var1.getCount();

      for(int var3 = 0; var3 < var2; ++var3) {
         Series var4 = var1.get(var3);
         this.a(var4, this.J + var3);
      }

   }

   static boolean a(zik var0) {
      return var0 != null && (var0.q() == 2 || var0.q() == 3);
   }

   private void a(Series var1, String var2) throws Exception {
      this.k.b("chart:series");
      String var3 = "";
      if (a(var1.l())) {
         var3 = b(var1.l());
      }

      this.k.a("chart", "values-cell-range-address", (String)null, var3);
      if (!this.b(this.f) || !this.c(var1.s().j())) {
         switch(var1.s().j()) {
         case 35:
         case 36:
            this.k.a("chart", "class", (String)null, "circle");
            break;
         default:
            this.k.a("chart", "class", (String)null, zaqh.e(var1.getType()));
         }
      }

      if (var1.getName() != null && !"".equals(var1.getName()) && var1.getName().startsWith("=")) {
         this.k.a("chart", "label-cell-address", (String)null, a(var1.getName()));
      }

      if (var1.getPlotOnSecondAxis() && this.c.getSecondValueAxis() != null && this.c.getSecondValueAxis().isVisible()) {
         this.k.a("chart", "attached-axis", (String)null, "secondary-y");
      }

      this.k.a("chart", "style-name", (String)null, (String)this.i.get(var2));
      if ((this.d(var1.s().j()) || this.e(var1.s().j())) && a(var1.m())) {
         this.k.b("chart:domain");
         this.k.a("table", "cell-range-address", (String)null, b(var1.m()));
         this.k.b();
      }

      if (var1.getTrendLines() != null && var1.getTrendLines().getCount() > 0) {
         this.a(var1.getTrendLines().get(0));
      }

      if (var1.getYErrorBar().getDisplayType() != 2) {
         this.a(var1.getYErrorBar());
      } else if (var1.getXErrorBar().getDisplayType() != 2) {
         this.a(var1.getXErrorBar());
      }

      this.a(var1);
      this.k.b();
   }

   private void w() throws Exception {
      String var1 = (String)this.i.get(this.v);
      if (this.g) {
         if (this.c.getWalls() != null) {
            this.k.b("chart:wall");
            this.k.a("chart", "style-name", (String)null, (String)this.i.get(this.L));
            this.k.b();
         }

         if (this.c.getFloor() != null) {
            this.k.b("chart:floor");
            this.k.a("chart", "style-name", (String)null, (String)this.i.get(this.M));
            this.k.b();
         }
      } else if (var1 != null) {
         this.k.b("chart:wall");
         this.k.a("chart", "style-name", (String)null, var1);
         this.k.b();
      }

   }

   private boolean b(int var1) {
      return this.f == 65 || this.f == 66 || this.f == 67 || this.f == 68;
   }

   private boolean c(int var1) {
      return this.f == 37 || this.f == 39 || this.f == 42 || this.f == 43 || this.f == 38 || this.f == 41 || this.f == 40;
   }

   private boolean d(int var1) {
      return this.f == 12 || this.f == 13;
   }

   private boolean e(int var1) {
      return this.f == 60 || this.f == 61 || this.f == 62 || this.f == 63 || this.f == 64;
   }

   private void a(Series var1) throws Exception {
      ChartPointCollection var2 = var1.getPoints();
      if (var2 != null && var2.getCount() >= 1) {
         ChartPoint var3 = null;
         int var4 = var2.getCount();
         int var5 = 1;

         for(int var6 = 0; var6 < var4; ++var6) {
            ChartPoint var7 = var2.get(var6);
            if (this.a(var3, var7)) {
               if (var6 != 0) {
                  if (var5 > 1) {
                     this.k.a("chart", "repeated", (String)null, com.aspose.cells.b.a.zo.a(var5));
                  }

                  this.k.b();
                  var5 = 1;
               }

               if (var6 + 1 <= var4) {
                  this.k.b("chart:data-point");
                  this.k.a("chart", "style-name", (String)null, (String)this.i.get(this.K + var1.B() + var6));
               }
            } else {
               ++var5;
            }

            var3 = var7;
         }

         if (var5 > 1) {
            this.k.a("chart", "repeated", (String)null, com.aspose.cells.b.a.zo.a(var5));
         }

         if (var4 > 0) {
            this.k.b();
         }

      }
   }

   private boolean a(ChartPoint var1, ChartPoint var2) {
      return var1 == null || !var2.getArea().getForegroundColor().equals(var1.getArea().getForegroundColor()) || !var2.getBorder().getColor().equals(var1.getBorder().getColor()) || var2.getBorder().getWeightPt() != var1.getBorder().getWeightPt();
   }

   private void a(Trendline var1) throws Exception {
      this.k.b("chart:regression-curve");
      boolean var2 = false;
      if (var1.getDisplayRSquared()) {
         this.k.a("chart", "display-r-square", (String)null, "true");
         if (!var1.getDisplayEquation()) {
            this.k.a("chart", "display-equation", (String)null, "false");
         }

         var2 = true;
      } else if (var1.getDisplayEquation()) {
         var2 = true;
      }

      if (var2) {
         if (var1.getDataLabels() != null) {
            ;
         }

         this.k.b("chart:equation");
         this.k.b();
      }

      this.k.b();
   }

   private void a(ErrorBar var1) throws Exception {
      if (var1 != null) {
         this.k.b("chart:error-indicator");
         this.k.b();
      }
   }

   private void a(boolean var1, DropBars var2) throws Exception {
      String var3 = var1 ? "chart:stock-gain-marker" : "chart:stock-loss-marker";
      this.k.b(var3);
      this.k.b();
   }

   private void a(Line var1) throws Exception {
      this.k.b("chart:stock-range-line");
      this.k.b();
   }

   private String x() {
      return "(22754.0383863584 13253.3437095935 31734.872606677)";
   }

   private String y() {
      return "(0.416199821709347 0.173649045905254 0.892537795986984)";
   }

   private String z() {
      return "(-0.0733876362771618 0.984807599917971 -0.157379306090273)";
   }

   private String f(int var1) {
      switch(var1) {
      default:
         return zaqh.e(var1);
      }
   }

   private String a(Line var1, boolean var2) {
      if (!var1.isVisible() && !var2) {
         return "none";
      } else {
         int var3 = var1.getStyle();
         switch(var3) {
         case 0:
         case 2:
         case 3:
         case 4:
         case 6:
         case 7:
         case 8:
            return "solid";
         case 1:
            return "dash";
         case 5:
         default:
            return "none";
         }
      }
   }

   private String g(int var1) {
      switch(var1) {
      case 0:
         return "bottom";
      case 1:
         return "top-end";
      case 2:
         return "top";
      case 3:
         return "end";
      case 4:
         return "start";
      default:
         return "";
      }
   }

   private double h(int var1) {
      return this.d * (double)var1 / 4000.0D;
   }

   private double i(int var1) {
      return this.e * (double)var1 / 4000.0D;
   }

   private double j(int var1) {
      return this.d * (double)var1 / 4000.0D;
   }

   private double k(int var1) {
      return this.e * (double)var1 / 4000.0D;
   }

   static String a(Chart var0) {
      StringBuilder var1 = new StringBuilder();
      String var2 = "";
      Iterator var3 = var0.getNSeries().iterator();

      while(var3.hasNext()) {
         Series var4 = (Series)var3.next();
         var1.append(var2);
         if (a(var4.l())) {
            a(var4.l(), var1);
            var2 = " ";
         }

         if (var4.getName().startsWith("=")) {
            var1.append(var2);
            var1.append(a(var4.getName()));
            var2 = " ";
         }
      }

      if (var1.length() > 0) {
         return com.aspose.cells.b.a.zr.a(var1);
      } else {
         return null;
      }
   }

   static void a(zik var0, StringBuilder var1) {
      if (var0 != null) {
         switch(var0.q()) {
         case 2:
         case 3:
         case 5:
            var1.append(b(var0));
         case 4:
         default:
         }
      }
   }

   static String b(zik var0) {
      String var1 = var0.h();
      return a(var1);
   }

   static String a(String var0) {
      if (!var0.startsWith("=")) {
         return var0;
      } else {
         var0 = var0.substring(1);
         var0 = com.aspose.cells.b.a.zv.a(var0, "$", "");
         if (var0.indexOf("!") < 0) {
            return var0;
         } else {
            String[] var1 = com.aspose.cells.b.a.zv.d(var0, '!');
            String var2 = var1[0];
            String[] var3 = com.aspose.cells.b.a.zv.d(var1[1], ':');
            String var4 = "";
            String var5 = "";

            for(int var6 = 0; var6 < var3.length; ++var6) {
               var4 = var4 + var5 + var2 + "." + var3[var6];
               var5 = ":";
            }

            return var4;
         }
      }
   }
}
